package com.wangbo.basic;

/**
 * 遍历
 */
public class Test {
    public static void main(String[] args) {
        Node<Integer> root = new Node(1);
        Node<Integer> second = new Node(2);
        Node<Integer> three = new Node(3);
        Node<Integer> four = new Node(4);
        Node<Integer> five = new Node(5);
        Node<Integer> six = new Node(6);
        Node<Integer> seven = new Node(7);
        Node<Integer> eight = new Node(8);
        Node<Integer> nine = new Node(9);
        Node<Integer> ten = new Node(10);
        Node<Integer> eleven = new Node(11);

        root.left=second;
        root.right=three;

        second.left=four;
        second.right=five;

        three.left=six;
        three.right=seven;

        five.left=eight;
        five.right=nine;

        six.right=eleven;

        seven.left=ten;

//        System.out.print("广度优先遍历结果："); // 广度优先遍历结果：1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> 11 -> 10
//        TraverseUtil.broadTraverse(root);
//        System.out.println();
//        System.out.print("深度优先遍历结果："); // 深度优先遍历结果：1 -> 2 -> 4 -> 5 -> 8 -> 9 -> 3 -> 6 -> 11 -> 7 -> 10
//        TraverseUtil.depthTraverse(root);
//        System.out.println();
//        System.out.print("前序遍历结果：");
//        TraverseUtil.preTraverse(root);
        System.out.print("蛇形遍历结果：");
        TraverseUtil.snakeTraverse(root);
        System.out.println();


    }
}
